package com.webssh.service.handler.terminal;

import java.io.Serializable;
import java.util.Date;
import java.util.UUID;

/**
 *  
 * @author zhanshuw
 *     	   2018年6月21日
 * 
 */
public class Terminal implements Serializable{

	private static final long serialVersionUID = -2383346401147507542L;
    private String name;
    private String userName;
    private String host;
    private int port;

    private String status = AuthStatus.SUCCESS.status;

    private Date logintime;

    private String password;

    private String clientId = UUID.randomUUID().toString();

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
    
    public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getHost() {
        return host;
    }

    public void setHost(String host) {
        this.host = host;
    }

    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public Date getLogintime() {
        return logintime;
    }

    public void setLogintime(Date logintime) {
        this.logintime = logintime;
    }

    public String getClientId() {
        return clientId;
    }

    @Override
    public String toString() {
        return "Terminal{" +
                ", host='" + host + '\'' +
                ", port=" + port +
                ", status='" + status + '\'' +
                ", logintime=" + logintime +
                ", password='" + password + '\'' +
                '}';
    }
    
    
    /**
     * 复制此终端登陆信息
     * @author  zhanshuw
     * 			2018年6月22日
     * @return
     */
    public Terminal copy(){
    	Terminal t = new Terminal();
    	t.name = this.name;
    	t.userName = this.userName;
    	t.host = this.host;
    	t.password = this.password;
    	t.port = this.port;
    	return t;
    }

    public enum AuthStatus {
        INITIAL("initial"),
        AUTH_FAIL("authfail"),
        PUBLIC_KEY_FAIL("keyauthfail"),
        GENERIC_FAIL("genericfail"),
        HOST_FAIL("hostfail"),
        SUCCESS("success");
        public String status;

        AuthStatus(String status){
            this.status = status;
        }

    }
}
